<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./template.xhtml">

            <ui:define name="title">
                Nhật ký sử dụng
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <p:dataTable value="#{eventManagerBean.list}" var="item" resizableColumns="true"
                                 paginator="#{eventManagerBean.list.size() >20}" rows="20">

                        <p:column headerText="Người dùng" sortBy="#{item.username}"
                                  filterBy="#{item.username}" filterMatchMode="contains">
                            #{item.username}
                        </p:column>
                        <p:column headerText="Địa chỉ IP" sortBy="#{item.ip}"
                                  filterBy="#{item.ip}" filterMatchMode="contains">
                            #{item.ip}
                        </p:column>
                        <p:column headerText="Thời gian" sortBy="#{item.eventTime}">
                            <h:outputText value="#{item.eventTime}">
                                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" timeZone="Asia/Saigon"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Hành động" sortBy="#{item.eventName}"
                                  filterBy="#{item.eventName}" filterMatchMode="contains">
                            #{item.eventName}
                        </p:column>
                        <p:column headerText="Chi tiết" sortBy="#{item.eventInfo}"
                                  filterBy="#{item.eventInfo}" filterMatchMode="contains">
                            #{item.eventInfo}
                        </p:column>
                    </p:dataTable>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
